/*
 * =====================================================================================
 *
 *       Filename:  1002_solution2.cc
 *
 *    Description:  see poj 1002 
 *
 *        Version:  1.0
 *        Created:  09/10/2012 02:09:18 AM
 *       Revision:  none
 *       Compiler:  gcc
 *
 *         Author:  Regan (), lcqhigh@gmail.com
 *        Company:  
 *
 * =====================================================================================
 */
#include	<stdio.h>
#include	<stdlib.h>
#include	<ctype.h>

static const int MAX_PHONE_NUM_VALUE = 10000000;
int countSet[MAX_PHONE_NUM_VALUE] = {0x00};

int main(int argc, char *argv[])
{
    int T;
    char tempStr[304] = {'\0'};
    char keyMap[128] = {'\0'};
    int  maxvalue = 0, minvalue = MAX_PHONE_NUM_VALUE;
    keyMap['A'] = keyMap['B'] = keyMap['C'] = 2;
    keyMap['D'] = keyMap['E'] = keyMap['F'] = 3;
    keyMap['G'] = keyMap['H'] = keyMap['I'] = 4;
    keyMap['L'] = keyMap['J'] = keyMap['K'] = 5;
    keyMap['M'] = keyMap['N'] = keyMap['O'] = 6;
    keyMap['P'] = keyMap['R'] = keyMap['S'] = 7;
    keyMap['T'] = keyMap['U'] = keyMap['V'] = 8;
    keyMap['W'] = keyMap['X'] = keyMap['Y'] = 9;

    scanf("%d", &T);
    while (T--)
    {
        scanf("%s", tempStr);
        int value = 0;
        char *p = tempStr;
        while (*p != '\0')
        {
            if (isdigit(*p))
                value = value * 10 + (*p - '0');
            else if (isupper(*p) && *p != 'Q' && *p != 'Z')
                value = value * 10 + keyMap[(int)*p];
            ++p;
        }
        if (value > maxvalue)
            maxvalue = value;
        if (value < minvalue)
            minvalue = value;
        ++countSet[value];
    }
    
    int existDup = 0;
    for (int idx = minvalue; idx <= maxvalue; ++idx)
    {
        if (countSet[idx] > 1)
        {
            printf ( "%03d-%04d %d\n", idx/10000, idx%10000, countSet[idx]);
            ++existDup;
        }
    }
    if (existDup == 0)
        printf ( "No duplicates.\n" );
    return 0;
}
